package com.newlink.building.main.mvp.presenter

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.main.mvp.contract.Module_Main_ResidentSearchContract
import com.newlink.building.main.mvp.model.Module_Main_ResidentSearchModel

/**
 * @Author: Jake
 * @Date: 2024-10-15
 * @Description:
 */
class Module_Main_ResidentSearchPresenter :
    BasePresenter<Module_Main_ResidentSearchContract.Model, Module_Main_ResidentSearchContract.View>(),
    Module_Main_ResidentSearchContract.Presenter {

    override fun createModel(): Module_Main_ResidentSearchContract.Model = Module_Main_ResidentSearchModel()
    override fun getPropertyUserList(token: String, prjId: String, name: String) {
        mModel?.getPropertyUserList(token, prjId, name)?.ss(mModel, mView) {
            mView?.getPropertyUserListSuccess(it?.data)
        }
    }

    override fun getRoomList(token: String, unitId: String, roomName: String) {
        mModel?.getRoomList(token, unitId, roomName)?.ss(mModel, mView) {
            mView?.getRoomListSuccess(it?.data)
        }
    }

    override fun getRoomUserList(token: String, roomId: String, name: String) {
        mModel?.getRoomUserList(token, roomId, name)?.ss(mModel, mView) {
            it?.data?.let { data ->
                mView?.getRoomUserListSuccess(data)
            }
        }
    }
}